package cn.ecnu.paper.mapper;

import cn.ecnu.paper.pojo.Belong;
import cn.ecnu.paper.vo.BelongVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface BelongMapper {

    @Insert("INSERT INTO belong(paper_id, field_id) VALUES (#{paperId}, #{fieldId})")
    int insertBelong(Belong belong);


    List<BelongVo> getBelongs(@Param("paperId") Integer paperId);

    @Delete("DELETE FROM belong WHERE paper_id = #{paperId}")
    int deleteBelongByPaperId(@Param("paperId") Integer paperId);
}
